﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BSCMFF.Core.DataAccessLayer;
using System.Web.Security;

namespace BSCMFF.Core.BusinessLayer
{
    public class RoleManager
    {
        public int GetRole_ID(string roleName)
        {
            BSCEntities context = new BSCEntities();

            int roleID = (from r in context.Roles
                          where r.Name == roleName
                          select r.Role_ID).SingleOrDefault();

            return roleID;
        }

        public string GetCurrentUserRole()
        {
            string[] roles = Roles.GetRolesForUser();

            if (roles.Count() == 1)
            {
                return roles[0];
            }
            else
            {
                return "";
            }
        }
    }
}
